import request from  '../index'

// 数据总览
export function getHomeData() {
    return new Promise((resolve, reject) => {
        const url = '/allData'
        request.get({url})
        .then(res => {
            return resolve(res)
        })
        .catch(err => {
            reject(err)
        })
    })
}

// 折线图
export function getContrastData() {
    return new Promise((resolve, reject) => {
        const url = '/contrast'
        request.get({ url })
        .then(res => {
            return resolve(res)
        })
        .catch(err => {
            reject(err)
        })
    })
}

// 销售员工提成表

export function salesWage() {
    return new Promise((resolve, reject) => {
        const url = '/sales'
        request.get({url}).then(res => {
            return resolve(res)
        })
        .catch(err => {
            reject(err)
        })
    })
}

// 商品月销售情况
export function waresList() {
    return new Promise((resolve, reject) => {
        const url = '/wares'
        request.get({url}).then(res => {
            return resolve(res)
        })
        .catch(err => {
            reject(err)
        })
    })
}

// 留言板
export function getMessage() {
    return new Promise((resolve, reject) => {
        const url = '/message'
        request.get({url}).then(res => {
            return resolve(res)
        })
        .catch(err => {
            reject(err)
        })
    })
}

// 临期或过期表
export function getOverDue () {
    return new Promise((resolve, reject) => {
        const url = '/overdue'
        request.get({ url }).then(res => {
            return resolve(res)
        })
        .catch(err => {
            reject(err)
        })
    })
}

// 根据id删除
export function del(id) {
    return new Promise((resolve, reject) => {
        const path = '/del'
        const params = {
            id: id
        }
        request.post(path, params).then(res => {
            return resolve(res)
        })
        .catch(err => {
            reject(err)
        })
    })
}